import request from '@/utils/request'

// 查询NovelStoryboard列表
export function listStoryboard(query) {
  return request({
    url: '/novel/storyboard/list',
    method: 'get',
    params: query
  })
}

// 查询NovelStoryboard详细
export function getStoryboard(id) {
  return request({
    url: '/novel/storyboard/' + id,
    method: 'get'
  })
}

// 根据小说ID和章节ID查询分镜列表
export function listStoryboardByNovelAndChapter(novelId, chapterId) {
  return request({
    url: `/novel/storyboard/list/${novelId}/${chapterId}`,
    method: 'get'
  })
}

// 新增NovelStoryboard
export function addStoryboard(data) {
  return request({
    url: '/novel/storyboard',
    method: 'post',
    data: data
  })
}

// 修改NovelStoryboard
export function updateStoryboard(data) {
  return request({
    url: '/novel/storyboard',
    method: 'put',
    data: data
  })
}

// 删除NovelStoryboard
export function delStoryboard(id) {
  return request({
    url: '/novel/storyboard/' + id,
    method: 'delete'
  })
}

// 生成分镜
export function generateStoryboard(data) {
  return request({
    url: '/novel/storyboard/generate',
    method: 'post',
    data: data,
    timeout: 0  // 不设置超时
  })
}

// 提取docx文字
export function extractDocxText(url) {
  return request({
    url: '/novel/storyboard/extract-text',
    method: 'post',
    params: { url }
  })
}

// 优化故事板提示词
export function optimizeStoryPrompt(data) {
  return request({
    url: '/API/gen/optimize-story-prompt',
    method: 'post',
    data: data,
    timeout: 0  // 不设置超时
  })
}

// 优化单个分镜图片提示词
export function optimizeStoryImgPrompt(data) {
  return request({
    url: '/API/gen/optimize-storyimg-prompt',
    method: 'post',
    data: data,
    timeout: 0  // 不设置超时
  })
}
